#ifndef NETWORK_SESSION_HH
#define NETWORK_SESSION_HH

#include <boost/asio.hpp>
#include <boost/function.hpp>
#include <iostream>
#include <string>

#define	NS_BUFSIZE						16

class								NetworkSession
{
private:
  boost::asio::ip::tcp::socket					mSocket;
  char								mInputData[NS_BUFSIZE];
  std::string							mOutputData;
  boost::function<void (NetworkSession &, void *, size_t)>	mCallbackReceive;

  NetworkSession(void);
  NetworkSession(const NetworkSession &);
  NetworkSession &						operator=(const NetworkSession &);
 
public:
  typedef boost::shared_ptr<NetworkSession>			NetworkSessionPtr;

  NetworkSession(boost::asio::io_service &, boost::function<void(NetworkSession &, void *, size_t)>);
  ~NetworkSession(void);

  void								handleReceive(const boost::system::error_code &, size_t);
  void								handleSend(const boost::system::error_code &);
  void								send(std::string);
  void								receive();
  boost::asio::ip::tcp::socket &				getSocket();
};

#endif // NETWORK_SESSION_HH
